/******************************************************************************
 * Copyright (C) 2015  671643387@qq.com
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *****************************************************************************/

#ifndef UCOP_SYSTEM_MUTEX_H_
#define UCOP_SYSTEM_MUTEX_H_

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif

#include "Ucop/Macros.h"
#ifdef _WIN32
#include "Ucop/System/Mutex_WIN32.h"
#else
#error
#endif


namespace Ucop {
namespace System {

    class Mutex: private MutexImpl
    {
    public:
        Mutex(void) : MutexImpl() { }
        ~Mutex(void) { }

        /* Lock the mutex */
        bool Lock(void) { return LockImpl(); }
        /* Try lock the mutex */
        bool TryLock(void) { return TryLockImpl(); }
        /* Unlock the mutex */
        void Unlock(void) { return UnlockImpl(); }
        /* Is the mutex locked */
        bool IsLocked(void) const { return IsLockedImpl(); }

    private:
        DISALLOW_COPY_AND_ASSIGN(Mutex);
    };

}}

#endif // UCOP_SYSTEM_MUTEX_H_
